<html>
<head>
<title>Login</title>
<!-- Simple login page -->
<script type="text/javascript">
function validate(form){
 var userName = form.Username.value;
 var email = form.Email.value;
 var errors = [];

 if (!checkLength(userName)) {
  errors[errors.length] = "You must enter a username.";
 }

 if (!checkLength(email)) {
  errors[errors.length] = "You must enter an email.";
 }

 if (errors.length > 0) {
  reportErrors(errors);
  return false;
 }

 return true;
}

function checkLength(text, min, max){
 min = min || 1;
 max = max || 10000;

 if (text.length < min || text.length > max) {
  return false;
 }
 return true;
}

function reportErrors(errors){
 var msg = "There were some problems...\n";
 var numError;
 for (var i = 0; i<errors.length; i++) {
  numError = i + 1;
  msg += "\n" + numError + ". " + errors[i];
 }
 alert(msg);
}

</script> 
</head>
<body>
<h1>Login to play!</h1>
<form method="post" action="index.html"
    onsubmit="return validate(this);">
<!-- Should put this data to the database -->
 Username: <input type="text" name="Username" size="30"><br/>
 Email: <input type="email" name="Email" size="30"><br/>

 <input type="submit" value="Submit">
 <input type="reset" value="Reset Form">
 
</form>
</body>
</html>